<?php
require_once '../conf.php';
require_once PATH_TO_SOURCE.'/model/model.php';
require_once PATH_TO_SOURCE.'/controller/controller.php';






$name = $_GET['url'];

$l = new category($name);

//print_r($l->getChildrenList());

$list = $l->getChildrenList();

$n= count($list);
$z=($n/3);
$content = "<ul class=\"tabels\">";

for($i=0;$i<$n;$i++){
	$url= $list[$i]['url'];
	$nazwa = $list[$i]['name_pl'];
	$calories = $list[$i]['calories'];
	
$content=$content."<li><a href=\"/".$url."\">".$nazwa."</a><div class=\"test\">(kcal:".$calories.")</div></li>";
	
	if(($i%$z)==0 && $i != 0){

		$content=$content."</ul><ul class=\"tabels\">";
	}
}
$content=$content."</ul>";


?>


<div class="list">
	<header class="grid col-full">
			<hr>
			<p class="fleft">Tabela kalorii, <?php echo $name ;?></p>
		</header>
								            
								<?php 
									echo $content;
								?>
					</div>	
